package com.magic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * Created by EricChen on 30/12/2016.
 */

@Configuration
public class MagicExistsCondition implements Condition {

    @Override
    public boolean matches(
            ConditionContext ctxt, AnnotatedTypeMetadata metadata) {

        Environment env = ctxt.getEnvironment();

        return env.containsProperty("magic");

    }
}
